{  Statement: http://acmp.ru/?main=task&id_task=284
   Verdict: Accepted
}
uses
    SysUtils, Math;

var
    i,n,j,x,y:longint;
    a:array[0..1010] of longint;

begin
reset(input,'input.txt');
rewrite(output,'output.txt');
read(n);
for i:=1 to n do
    read(a[i]);
read(n);
for i:=1 to n do begin
    read(x,y);
    for j := x to y do
        write(a[j],' ');
    writeln;
end;
end.